Skip to content

Conversation

@xvw
Copy link
Collaborator

@xvw xvw commented Feb 25, 2025

Should resolve #1449

@xvw xvw requested review from trefis and voodoos February 25, 2025 14:57
@xvw xvw force-pushed the document-symbol-for-class-and-class-types branch from 109e180 to e317de2 Compare February 25, 2025 14:58
~kind:Class
~range:(Range.of_loc decl.pci_loc)
~selectionRange:(Range.of_loc decl.pci_name.loc)
~children:(visit_class_sig decl.pci_expr)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you don't rely on the iterator for nested symbols like it's done in other cases, isn't there a risk that we would miss some of these nested symbols ?

Like x in class a = object method f = let x = 42 in x end ?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure you want to return that x, local value are usually not listed AFAICT (but don't take my word for it)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question. From my (perhaps clumsy) point of view, I get the impression that we want to be able to navigate in all outlines, don't we?

Copy link
Collaborator

@voodoos voodoos Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it in vscode before writing my comment, and local values do show in the "outline",but maybe that's another request ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

@xvw xvw changed the title Add support for class, class types and methods in DocumentSymbol Draft: Add support for class, class types and methods in DocumentSymbol Feb 25, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 4767

Details

  • 30 of 46 (65.22%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.7%) to 22.906%

Changes Missing Coverage Covered Lines Changed/Added Lines %
ocaml-lsp-server/src/document_symbol.ml 30 46 65.22%
Files with Coverage Reduction New Missed Lines %
ocaml-lsp-server/src/document_symbol.ml 2 33.33%
Totals Coverage Status
Change from base Build 4763: 0.7%
Covered Lines: 5852
Relevant Lines: 25548

💛 - Coveralls

@coveralls
Copy link

coveralls commented Feb 25, 2025

Pull Request Test Coverage Report for Build 4771

Details

  • 32 of 53 (60.38%) changed or added relevant lines in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.8%) to 22.978%

Changes Missing Coverage Covered Lines Changed/Added Lines %
ocaml-lsp-server/src/document_symbol.ml 32 53 60.38%
Files with Coverage Reduction New Missed Lines %
ocaml-lsp-server/src/document_symbol.ml 2 41.58%
Totals Coverage Status
Change from base Build 4763: 0.8%
Covered Lines: 5872
Relevant Lines: 25555

💛 - Coveralls

@xvw xvw changed the title Draft: Add support for class, class types and methods in DocumentSymbol Add support for class, class types and methods in DocumentSymbol Feb 26, 2025
@xvw
Copy link
Collaborator Author

xvw commented Feb 26, 2025

The PR is reviewable!

@voodoos
Copy link
Collaborator

voodoos commented Feb 28, 2025

Thanks Xavier, looks good to go.

@voodoos voodoos merged commit 83000eb into ocaml:master Feb 28, 2025
6 checks passed
@xvw xvw deleted the document-symbol-for-class-and-class-types branch April 17, 2025 12:48
voodoos pushed a commit to voodoos/ocaml-lsp that referenced this pull request Jun 6, 2025
…ml#1487)

* Add support for class, class types and methods in DocumentSymbol

* Add (failing) test for nested let inside objects and methods

* Add missing section FIXES in CHANGES

* Deal with nesting definition

* Relay on `Ast_iterator` for traversing outlines
voodoos added a commit to voodoos/opam-repository that referenced this pull request Jun 23, 2025
CHANGES:

## Features

- Make `inlay-hint` for function parameters configurable (ocaml/ocaml-lsp#1515)

- Add custom `ocamllsp/jumpToTypedHole` to navigate through typed holes (ocaml/ocaml-lsp#1516)

- Add a code-action for combining pattern cases (just relaying on regex) (ocaml/ocaml-lsp#1514)

- Allow (by configuration) shortening of diagnostics (just highlighting the first line) (ocaml/ocaml-lsp#1513)

- Fix `yojson_of_t` for `Nullable_option`: serialize `None` as `Null` instead of asserting false (ocaml/ocaml-lsp#1525 fixes ocaml/ocaml-lsp#1524)

## Fixes

- Support for `class`, `class type`, `method` and `property` for `DocumentSymbol` query (ocaml/ocaml-lsp#1487 fixes ocaml/ocaml-lsp#1449)

- Fix `inlay-hint` for function parameters (ocaml/ocaml-lsp#1515)

- More precise diagnostics in the event of a failed identifier search (`Definition_query`) (ocaml/ocaml-lsp#1518)

- Remove `ocamlformat` application after `destruct` (that remove some useful parenthesis) (ocaml/ocaml-lsp#1519)

- Add a new server option `standardHover`, that can be used by clients to
  disable the default hover provider.  When `standardHover = false`
  `textDocument/hover` requests always returns with empty result. (ocaml/ocaml-lsp#1416)
voodoos added a commit to voodoos/opam-repository that referenced this pull request Jun 23, 2025
CHANGES:

## Features

- Make `inlay-hint` for function parameters configurable (ocaml/ocaml-lsp#1515)

- Add custom `ocamllsp/jumpToTypedHole` to navigate through typed holes (ocaml/ocaml-lsp#1516)

- Add a code-action for combining pattern cases (just relaying on regex) (ocaml/ocaml-lsp#1514)

- Allow (by configuration) shortening of diagnostics (just highlighting the first line) (ocaml/ocaml-lsp#1513)

- Fix `yojson_of_t` for `Nullable_option`: serialize `None` as `Null` instead of asserting false (ocaml/ocaml-lsp#1525 fixes ocaml/ocaml-lsp#1524)

## Fixes

- Support for `class`, `class type`, `method` and `property` for `DocumentSymbol` query (ocaml/ocaml-lsp#1487 fixes ocaml/ocaml-lsp#1449)

- Fix `inlay-hint` for function parameters (ocaml/ocaml-lsp#1515)

- More precise diagnostics in the event of a failed identifier search (`Definition_query`) (ocaml/ocaml-lsp#1518)

- Remove `ocamlformat` application after `destruct` (that remove some useful parenthesis) (ocaml/ocaml-lsp#1519)

- Add a new server option `standardHover`, that can be used by clients to
  disable the default hover provider.  When `standardHover = false`
  `textDocument/hover` requests always returns with empty result. (ocaml/ocaml-lsp#1416)
voodoos added a commit to voodoos/opam-repository that referenced this pull request Jun 24, 2025
CHANGES:

## Features

- Make `inlay-hint` for function parameters configurable (ocaml/ocaml-lsp#1515)
- Add custom `ocamllsp/jumpToTypedHole` to navigate through typed holes (ocaml/ocaml-lsp#1516)
- Add a code-action for combining pattern cases (just relaying on regex) (ocaml/ocaml-lsp#1514)
- Allow (by configuration) shortening of diagnostics (just highlighting the first line) (ocaml/ocaml-lsp#1513)
- Fix `yojson_of_t` for `Nullable_option`: serialize `None` as `Null` instead of asserting false (ocaml/ocaml-lsp#1525 fixes ocaml/ocaml-lsp#1524)

## Fixes

- Support for `class`, `class type`, `method` and `property` for `DocumentSymbol` query (ocaml/ocaml-lsp#1487 fixes ocaml/ocaml-lsp#1449)
- Fix `inlay-hint` for function parameters (ocaml/ocaml-lsp#1515)
- More precise diagnostics in the event of a failed identifier search (`Definition_query`) (ocaml/ocaml-lsp#1518)
- Remove `ocamlformat` application after `destruct` (that remove some useful parenthesis) (ocaml/ocaml-lsp#1519)
voodoos added a commit to voodoos/opam-repository that referenced this pull request Jun 24, 2025
CHANGES:

## Features

- Make `inlay-hint` for function parameters configurable (ocaml/ocaml-lsp#1515)
- Add custom `ocamllsp/jumpToTypedHole` to navigate through typed holes (ocaml/ocaml-lsp#1516)
- Add a code-action for combining pattern cases (just relaying on regex) (ocaml/ocaml-lsp#1514)
- Allow (by configuration) shortening of diagnostics (just highlighting the first line) (ocaml/ocaml-lsp#1513)
- Fix `yojson_of_t` for `Nullable_option`: serialize `None` as `Null` instead of asserting false (ocaml/ocaml-lsp#1525 fixes ocaml/ocaml-lsp#1524)

## Fixes

- Support for `class`, `class type`, `method` and `property` for `DocumentSymbol` query (ocaml/ocaml-lsp#1487 fixes ocaml/ocaml-lsp#1449)
- Fix `inlay-hint` for function parameters (ocaml/ocaml-lsp#1515)
- More precise diagnostics in the event of a failed identifier search (`Definition_query`) (ocaml/ocaml-lsp#1518)
- Remove `ocamlformat` application after `destruct` (that remove some useful parenthesis) (ocaml/ocaml-lsp#1519)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

documentSymbol missing elements

4 participants